class Exercise

    def initialize(fullname)
        @fullname=fullname
    end

    def rearrange
        original_array = @fullname.split(' ')
        lastname = original_array[1]
        middlename = /(^\w)/.match("#{original_array[2]}")[1]
        firstname = /(\w+)/.match("#{original_array[0]}")[1]
        "#{lastname} #{middlename}. #{firstname}"
    end
end

